// import { Routes, Route, RouterModule } from '@angular/router';
import { WelcomeComponent } from './pages/welcome/welcome.component';
import { InvitationDialogComponent } from './pages/InvitationDialog/InvitationDialog.component';
import { WorkSpaceComponent } from './pages/workSpace/workSpace.component';
import { MyShareComponent } from './pages/myShare/myShare.component';
import { RecycleBinComponent } from './pages/recycleBin/recycleBin.component';
import { ExcelComponent } from './pages/workSpace/excel/excel.component';
import { MTableComponent } from './pages/m-table/m-table.component';
import { multOnlineExcelComponent } from './pages/multonlineexcel/multonlineexcel.component';
import { LoginComponent } from './pages/login/login.component';
import { LayoutComponent } from './layout/layout.component';
import { AuthGuardService } from './auth.service';

export const routes: any = [
  { path: '', pathMatch: 'full', redirectTo: '/dashboard/welcome' },
  { path: 'login', component: LoginComponent },
  {
    path: 'dashboard',
    component: LayoutComponent,
    canActivate: [AuthGuardService],
    meta: {
      menuTitle: '概览'
    },
    children: [
      {
        path: 'welcome',
        component: WelcomeComponent,
        meta: {
          menuTitle: '项目信息'
        }
      },
      {
        path: 'm-table',
        component: MTableComponent,
        meta: {
          menuTitle: '表格应用'
        }
      },
      {
        path: 'multonlineexcel',
        component: multOnlineExcelComponent,
        meta: {
          menuTitle: '多人协作表格'
        }
      }
    ]
  },
  {
    path: 'work',
    component: LayoutComponent,
    canActivate: [AuthGuardService],
    meta: {
      menuTitle: '工作台'
    },
    children: [
      {
        path: 'workSpace',
        component: WorkSpaceComponent,
        meta: {
          menuTitle: '工作空间'
        }
      },
      {
        path: 'workSpace/excel',
        component: ExcelComponent,
        hide: true, // 隐藏路由
        meta: {
          menuTitle: 'excel'
        }
      },
      {
        path: 'myShare',
        component: MyShareComponent,
        meta: {
          menuTitle: '我的分享'
        }
      },
      {
        path: 'recycleBin',
        component: RecycleBinComponent,
        meta: {
          menuTitle: '回收站'
        }
      }
    ]
  },
  {
    path: 'invited',
    component: InvitationDialogComponent,
    canActivate: [AuthGuardService],
    hide: true, // 隐藏路由
    meta: {
      menuTitle: '邀请加入'
    }
  }
];
